package com.kizitonwose.calendarview;

import ohos.agp.components.ComponentContainer;
import ohos.app.Context;
import ohos.global.resource.NotExistException;
import ohos.global.resource.WrongTypeException;

import java.io.IOException;
import java.util.List;

/**
 * @author LiuQingHua
 * @version 1.0
 * @date 2021/2/18 16:21
 */
public class HomeOptionsProvider extends QuickBaseItemProvider<ExampleItem> {

    public HomeOptionsProvider(Context context,List<ExampleItem> mData) {
        super(context,mData);
    }

    @Override
    protected int getComponentResourceLayout(ComponentContainer componentContainer, int componentType) {
        return ResourceTable.Layout_home_options_item_view;
    }

    @Override
    protected void bindComponentHolder(BaseComponentHolder holder, int position, int componentType) {
        try {
            holder.setText(ResourceTable.Id_itemOptionTitle, getContext().getResourceManager().getElement(getItem(position).getTitleRes()).getString());
            holder.setText(ResourceTable.Id_itemOptionSubtitle, getContext().getResourceManager().getElement(getItem(position).getSubtitleRes()).getString());
        } catch (IOException e) {
            e.printStackTrace();
        } catch (NotExistException e) {
            e.printStackTrace();
        } catch (WrongTypeException e) {
            e.printStackTrace();
        }
    }

}
